import request from 'umi-request';

export async function getMessageRolePageList(params) {
  return request('/api/member/api-member/noticeRole/getNoticeRoleList', {
    method: 'post',
    data: {
      name: params.name,
      pageNum: params.current,
      pageSize: params.pageSize,
    },
    requestType: 'form'
  }).then((res) => {
    const data = res.data;
    if (res.flag) {
      return {
        current: data.currPage,
        data: data.list,
        pageSize: data.pageSize,
        success: true,
        total: data.totalCount,
      };
    } else {
      return {};
    }
  });
}

export async function addMessageRoleInterface(params) {
  return request(`/api/member/api-member/noticeRole/updateNoticeRoleList`, {
    method: 'post',
    data: params,
  }).then((res) => {
    return res;
  });
}

export async function deleteMsgRole(msgRoleId) {
  return request(`/api/member/api-member/noticeRole/deleteNoticeRole?roleId=${msgRoleId}`, {
    method: 'delete',
  }).then((res) => {
    return res;
  });
}


